﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Hello, World!</title>
    <style type="text/css">
        body {color:#<%=FontColor%>;font-family:Verdana;background-color:Transparent;}  
        .message {display:inline-block;padding:0 5px 5px 0;}
        .message a, .message a:visited {color:#<%=FontColor%>;}
        #viewport {width:<%=ViewportWidth %>px;height:<%=ViewportHeight %>px;padding: 0 5px 0 5px;text-align:center;}
    </style>
    <%if(RandomizePosition) { %>
    <style type="text/css">
        .message {position:absolute;}
    </style>
    <%} %>
</head>
<body>
    <form id="form1" runat="server">
        <div id="viewport">
            <asp:PlaceHolder ID="ph1" runat="server"></asp:PlaceHolder>
        </div>  
    </form>
    <%if(RandomizePosition) { %>
    <script language="javascript" type="text/javascript">
    var vHeight = <%=ViewportHeight %>;
    var vWidth = <%=ViewportWidth %>;
    
    var divs = document.getElementsByTagName("div");
    if(divs != null)
    {        
        for(i=0; i<divs.length; i++)
        {
            var divclass = divs.item(i).attributes.getNamedItem("class");
            if(divclass && divclass.nodeValue == "message")
            {
                var rndLeft = Math.floor(Math.random()*vWidth);
                var rndTop = Math.floor(Math.random()*vHeight);
                
                divs.item(i).style.left = parseInt(rndLeft) + "px";
                divs.item(i).style.top = parseInt(rndTop) + "px";                
            }
        }
    }
    </script>
    <%} %>
</body>
</html>
